package edu.pku.sei.mte.transformation.qvt;

import java.util.ArrayList;
import java.util.List;

import edu.pku.sei.mte.constants.SearchResult;
import edu.pku.sei.mte.mtemodel.mtmodel.rulebased.Relation;
import edu.pku.sei.mte.runtime.Context;
import edu.pku.sei.mte.runtime.rulebased.RBTEnvironment;

public class QVTCheckResultVisitor extends QVTSemanticVisitor {

	public QVTCheckResultVisitor(RBTEnvironment env) {
		super(env);
	}

	@Override
	public Object visitRelation(Relation e) throws Exception {
		List<Context> satisfied = new ArrayList<Context>();
		SearchResult result = getSemantic().findContext(e, getContextStack().peek(), satisfied, null, false);
		if(result==SearchResult.SOURCE_NO_FOUND)
			return null;
		return satisfied;
	}

}
